<template>
	<scroll-view scroll-y class="scroll-Y" @scrolltolower="lower">
		<view class="container">
			<view class="tipsBox" v-if="listData.length <= 0">暂无提现记录</view>
			<view class="box" v-for="(item,index) in listData" v-else>
				<view class="left">
					<view class="money">提现金额：{{item.money}}元</view>
					<view class="time">{{item.createtime}}</view>
				</view>
				<!-- 提现状态 -->
				<view class="right">
					<view class="T1" v-if="item.status == 0">审核中</view>
					<view class="T2" v-if="item.status == 1">已审核，未打款</view>
					<view class="T3" v-if="item.status == 2">失败</view>
					<view class="T2" v-if="item.status == 3">成功</view>
				</view>
			</view>

			

		</view>
	</scroll-view>
</template>

<script>
	var app = getApp();
	export default {
		data() {
			return {
				status: 1, // 提现状态
				money: '1.00', // 提现金额
				time: "2023-11-11 12:00", // 提现时间
				page: 1, //当前页
				listData: [],
				totalPage: 0, //总页数
				pageType: '1', //页面状态1:合伙人 2:商家
			}
		},

		onLoad(opt) {
			this.pageType = uni.getStorageSync('pageType');
			this.getList();
		},

		methods: {
			//获取list列表
			getList() {
				let _this = this;
				let ajaxUrl = '';
				this.loading = true;
				if (this.pageType == '1') {
					app.post('ApiAgent/commissionlog', {
						st: 1
					}, function(res) {
						let list = res.data;
						list.forEach(item => {
							_this.listData.push(item);
						})
						_this.totalPage = res.data.last_page;
						// _this.listData = res.data;
					});
				} else {
					app.get('ApiBusiness/bwithdrawlog', {
						page: _this.page
					}, function(res) {
						let list = res.data.data;
						list.forEach(item => {
							_this.listData.push(item);
						})
						_this.totalPage = res.data.last_page;
					});
				}
			},
			// 滚动到底部
			lower() {
				if (this.page < this.totalPage) {
					this.page++;
					this.getList();
				}
			}
		}
	}
</script>


<style lang="scss">
	
	.tipsBox{
		width:94%;
		margin:0 3%;
		font-weight: bold;
		font-size:32rpx;
		display: flex;
		align-items: center;
		letter-spacing: 1px;
		text-align: center;
		color:#adadad;
		justify-content:center;
		height: 98vh;
	}
	.scroll-Y {
		height: 98vh;

		.container {
			display: flex;
			flex-direction: column;
			align-items: center;

			.box {
				width: 94vw;
				line-height: 55rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 20rpx;
				box-shadow: 0 2px 5px #CCCCCC;
				margin: 30rpx 0 10rpx 0;
				border-radius: 8px;

				.left {
					.time {
						color: #333;
					}
				}

				.right {

					.T1 {
						color: #4c4c4c;
					}

					.T2 {
						color: #0ebc0c;
					}

					.T3 {
						color: red;
					}
				}
			}
		}
	}
</style>